#    One Room And A Goblin Invasion
#    Copyright (C) 2014  Jannik Haberbosch
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

import pygame
pygame.init()

from code.Goblin import Goblin
from code.Timer import Timer
from code import goblin_constants
from code.AnimatedSprite import AnimatedSprite
from code.ProjectileExplosion import ProjectileExplosion


def create_goblin(
	initial_location,
	angle
	):

	goblin = Goblin(
		AnimatedSprite(
			goblin_constants.ANIMATION_WALKING_IMAGES,
			initial_location,
			Timer(
				*goblin_constants.ANIMATION_WALKING_TIMER_INFO
			),
			initial_angle = angle
		),
		AnimatedSprite(
			goblin_constants.ANIMATION_STANDING_IMAGES,
			initial_location,
			Timer(
				*goblin_constants.ANIMATION_STANDING_TIMER_INFO
			),
			initial_angle = angle
		),
		10, # Minimum amount of frames that a goblin keeps on walking ( TO MY KNOWLEDGE, THIS IS NOT USED ANYMORE. )
		250 # Maximum amount of frames that a goblin keeos on walking ( TO MY KNOWLEDGE, THIS IS NOT USED ANYMORE. )
		# A random value between those two ranges is chosen.
	)

	return goblin


def create_projectile_explosions(
	collided_projectiles,
	projectile_explosions ):
	"""

	"""
	for x in collided_projectiles:
		projectile_explosions.append(
			ProjectileExplosion(
				x.rect.center
			)
		)
